package com.hanamaki.unit.testng.work;

/**
 * 长方形
 */
public class Square {

    private double a;
    private double b;

    public boolean isSquare(double a, double b) {
        if (a != 0 && b != 0) {
            this.a = a;
            this.b = b;
            return true;
        } else {
            return false;
        }
    }

    /**
     * 计算周长
     * @return
     */
    public double perimeter() {
        return 2 * (a + b);
    }

    /**
     * 计算面积
     * @return
     */
    public double area() {
        return a * b;
    }
}
